Skip to main content

textDecode

Type

function

Summary

Converts from binary data to text.

Syntax

textDecode(<binaryData>, <encoding>)

Description

Converts from binary data to text.

The textDecode function takes binary data, in the specified encoding, and returns the given string as text.

The encoding is matched case-insensitively and most punctuation (such as "-") is ignored. This means that "UTF8", "utf-8", and "u.t.f.8" are all valid names to use for the utf-8 encoding. More information about this can be found on the Unicode Consortium Site.

It is highly recommended that any time you interface with things outside LiveCode (files, network sockets, processes, etc) that you explicitly textEncode any text you send outside LiveCode and textDecode all text received into LiveCode. If this doesn't happen, a platform-dependent encoding will be used (which normally does not support Unicode text).

It is not, in general, possible to reliably auto-detect text encodings so please check the documentation for the programme you are communicating with to find out what it expects. If in doubt, try UTF-8.

Parameters

NameTypeDescription

binaryData

Binary data to be

encoding

enum

The encoding of the original data

Examples

textDecode("A","UTF-8")
put url ("file:input.txt") into tTextToDecode
put textDecode(tTextToDecode,"ASCII") into field "input"

function: textEncode

Compatibility and Support

Introduced

LiveCode 7.0

OS

mac

windows

linux

ios

android

Platforms

desktop

server

mobile

Thank you for your feedback!

Was this page helpful?